package ex;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author xizizzz
 * @description: TODO
 * @date 2021-9-7下午 05:37
 */
public class LRU {

    public void LRU(int cap) {
        final LinkedHashMap<Integer, Integer> cache = new LinkedHashMap<Integer, Integer>(cap, 0.75f, true) {
            @Override
            protected boolean removeEldestEntry(Map.Entry<Integer, Integer> eldest) {
                return size() > cap;
            }
        };
        cache.get(11111);
        cache.put(1, 1);
    }

}
